home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / util / thedit20.zip / rm.the < prev    next >
Text File  |  1995-01-26  |  2KB  |  63 lines

  1. /*
  2. $Id: rm.the 2.0 1995/01/26 16:31:58 MH Release MH $
  3. */
  4. /***********************************************************************/
  5. /* Description: REXX macro to delete a file from a DIR.DIR file.       */
  6. /* Syntax:                                                             */
  7. /* Notes:       This macro deletes the line from the DIR.DIR file and  */
  8. /*              the actual file from disk.                             */
  9. /*              Use with caution.                                      */
  10. /***********************************************************************/
  11. Trace o
  12. 'EXTRACT /TOF/EOF/VERSION/DIRFILEID/CURLINE/'     /* get various stuff */
  13. If rc \= 0 Then
  14.    Do
  15.      Say 'Error in EXTRACT:' rc
  16.      Exit 1
  17.    End
  18. If \dir() Then
  19.    Do
  20.      'emsg ERROR: rm.the can only be run from the DIR.DIR file'
  21.      Exit 1
  22.    End
  23. If \modifiable() Then
  24.    Do
  25.      'emsg ERROR: invalid cursor position'
  26.      Exit 1
  27.    End
  28. If version.2 = '1.5' Then oncommand = command()
  29. Else oncommand = incommand()
  30. If oncommand Then
  31.    Do
  32.      If tof.1 = 'ON' | eof.1 = 'ON' Then
  33.         Do
  34.           'emsg ERROR: cannot delete TOF or EOF line'
  35.           Exit 1
  36.         End
  37.    End
  38. Select
  39.   When version.3 = 'UNIX' & Substr(curline.3,1,1) = 'd' Then
  40.      Do
  41.        'emsg ERROR: cannot delete directories'
  42.        Exit 1
  43.      End
  44.   When version.3 = 'DOS' & Substr(curline.3,6,3) = 'dir' Then
  45.      Do
  46.        'emsg ERROR: cannot delete directories'
  47.        Exit 1
  48.      End
  49.   When version.3 = 'OS2' & Substr(curline.3,6,3) = 'dir' Then
  50.      Do
  51.        'emsg ERROR: cannot delete directories'
  52.        Exit 1
  53.      End
  54.   Otherwise Nop
  55. End
  56. If version.3 = 'UNIX' Then delcmd = 'osq rm -f'
  57. Else delcmd = 'osq del'
  58. 'sos delline'
  59. filename = dirfileid.1||dirfileid.2
  60. delcmd filename
  61. 'msg File' filename 'deleted'
  62. Return 0
  63.